/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.aurelius.jmx;

import de.aurelius.jmx.mxbean.BasicImplementaion;
import de.aurelius.jmx.mxbean.SimpleMXBeanImplementator;
import java.lang.management.ManagementFactory;
import java.util.Scanner;
import javax.management.MBeanServer;
import javax.management.ObjectName;

/**
 *
 */
public class JmxMainApp {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
        try {
            ObjectName objectName = new ObjectName("de.aurelius.jmx:type=Hello");
            ObjectName objectName2 = new ObjectName("de.aurelius.jmx:type=Simple");
            ObjectName objectName3 = new ObjectName("de.aurelius.jmx:type=Basic");
            platformMBeanServer.registerMBean( new Hello(), objectName);
            platformMBeanServer.registerMBean( new SimpleMXBeanImplementator(), objectName2);
            platformMBeanServer.registerMBean( new BasicImplementaion(), objectName3);
        } catch (Exception ex) {
            System.err.println("Error in object name");
            System.err.println(ex.getMessage());
            System.err.println(ex.getCause());
        }

        Scanner scanner = new Scanner(System.in);
        scanner.next();

    }
}
